<?php
include_once('includes/module.query.php');
class SqlPuser
{
/*
*
*/
	protected function get_puser($nickname)
	{ 
	return query("SELECT * FROM puser WHERE nickname = ? LIMIT 1", array($nickname));
	return $query;
	}
	
	protected function register($nickname ,$name_puser ,$surname_puser, $email, $pass)
	{
		return query("
			INSERT INTO `puser` ( `nickname` ,`name_puser` ,`surname_puser` , `pass` , `email` )
			VALUES(?, ?, ?, ?, ?)	
		", array($nickname ,$name_puser ,$surname_puser, $pass, $email));
	}

  protected function delete_puser($nickname)
	{
		return query("DELETE FROM puser WHERE nickname = ? LIMIT 1", array($nickname));
	}
	
	
	protected function get_puser_assocs($nickname){
		
		return query("SELECT t3.name_assoc t3.description, t3.email, t3.room FROM puser AS t1, puserassoc AS t2, association AS t3 WHERE t1.nickname=t2.nickname AND t2.name_assoc=t3.name_assoc AND t1.nickname= ? LIMIT 1",array($nickname));
	}
	
	protected function get_resources_puser($nickname)
	{
		
		return query("SELECT t2.id_assocresource t2. FROM puser AS t1, assocresource AS t2
		WHERE t1.nickname=t2.nickname AND t2.nickname=? ",array($nickname));
	}
	
	
	
}
?>
